• Welcome to AnyRail Model Railroad Forum. Please login or sign up.
February 20, 2020, 02:12:40 am


Due to heavy spamming attempts on this forum, automatic registration has been disabled. We will approve registration requests as quickly as possible (unless you're a spammer of course :) )

Reverse Loop Problem

Started by Future-Digital, August 21, 2019, 06:35:23 pm

Previous topic - Next topic



I don't believe I have any of Bachmann's auto reversing track in this mess. Didn't intend to.

I am transitioning from Bachmann sectional track to flex track, type is really undetermined.

However, I have a TON of brand new Bachmann DCC track turnouts, and it is reflected in the layout. I am really reluctant to not use those, along with a very nice set of controllers and power supplies new in box. It would cost a pretty penny to just toss all those items, dozens of expensive parts, just to avoid using Bachmann.

After a month long excursion throughout the American west earlier this summer, I have decided that my plan on using mixed flex track and Bachmann DCC turnouts isn't far fetched. The differences in appearance are easily disguised, and certainly fit in with what I saw of track over that 7690 mile trip from Louisiana to Arkansas, Kansas, Colorado, Wyoming, Idaho, Oregon, California, Arizona, New Mexico and Texas and back. There is NO fixed look to track or track beds in real life, so anything I use will be visibly workable.

There are underpasses and popups and popups and doorways on and around the layout that you can't see from the simple track layout I sent the forum. Not ideal, but it maximizes the extent of the layout.

Also, there are elevations on the layout, constrained to a max of 2% throughout, with possible tiny deviations. From what I have always understood, 2% is a good limit, or so I have been told dozens of times on this forum and elsewhere.

Is that old news to be discarded? I actually dropped the elevation of the trestles to fit within those 2% limits. Had them up to 4 or 5% for experiments, but got called out on that right away.

I still don't seem to have any indications of where I should take action on this proposed track to alleviate the reverse polarity problem by any name.

Ideas, anyone?

"I find television very educating. Every time somebody turns on the set, I go into the other room and read a book." - Groucho Marx

Tom Springer


There are actually 2 'reverse loop' areas in your layout; the 2nd will be identified by AnyRail once the 1st one is "removed".

Attached is a modified version of your ANY file with the 2 problematic track areas colored in green (1st) and orange (2nd), and showing the 2 places in each where electrical isolation needs to be provided.  I believe this resolves the purpose of this thread.  Everything else in the thread then can be ignored.  Note that the reverse loop condition will still be detected by AnyRail as long as the 2 ends of the green track and the 2 ends of the orange track are connected; disconnect one of the ends of each and AnyRail will no longer report a reverse loop condition.
Tom Springer

(Unintentional Pyromaniac)

Nick the Nomad

This would appear to be one of the reasons that I have stuck with DC control.  My favourite "style" of layout is the dumbbell, with storage loops at either end.  Double track main line in between ==> two controllers.  Trains enter the loop under one controller, and leave under the other.  No cross polarity involved.


Nick the Nomad
Currently in beautiful Bicheno (look it up)



I understand where you are coming from. None-the-less, I'm going to try DCC.


Oh, I see, said the blind man.

Question: You put in Electrical Isolators in different places then those I had placed around the two angle crossing points. The 90 degree and the 45 degree.

I fully see the effect of what you did, but perhaps I still don't understand the WHY of why you placed yours where you did instead of where I placed mine. (Marked in blue)

If I disconnect the two angle crossings, both Reversing loops disappear in both instances. Just like with yours.

I suppose my question arises from not knowing enough to know why your solution would be better than mine.

Can you please explain, as well as you demonstrated before?

Thank you.

"I find television very educating. Every time somebody turns on the set, I go into the other room and read a book." - Groucho Marx

Nick the Nomad


I should have added two more reasons for staying with DC.

1) Cost!

2) I like the idea of being able to have more than one train circulating at any given time.  With DCC you have to be absolutely sure that there are no conflicting movements, as, to my mind, it's too hard to sort out a potential incident without simply hitting the Kill button.  A well-designed, dead-frog, properly isolated layout will prevent any conflicts actually doing any damage.


Nick the Nomad
Now in St Helens, Tasmania

Tom Springer

September 06, 2019, 03:40:43 am #20 Last Edit: September 06, 2019, 04:46:08 am by Tom Springer Reason: forgot to enable Grammarly because I really need it

Quote from: Future-Digital on September 03, 2019, 05:37:08 pmIf I disconnect the two angle crossings, both Reversing loops disappear in both instances.

If all you did was to disconnect (i.e., logically remove) the crossing(s) and not replace them with other track pieces, then you don't get a 'reverse loop' detected by AnyRail because there isn't a complete path anymore.  If you replace the crossings with simple pieces of tracks, one 'laid' on top of the other (the 90 degree is the easier to visualize being replaced by 2 short track segments, each the length of one path through the crossing) then the path is 'complete' (connected) and you'll still get a 'reverse loop' detected.

Quote from: Future-Digital on September 03, 2019, 05:37:08 pmQuestion: You put in Electrical Isolators in different places then those I had placed around the two angle crossing points. The 90 degree and the 45 degree.

I fully see the effect of what you did, but perhaps I still don't understand the WHY of why you placed yours where you did instead of where I placed mine. (Marked in blue)

I think this comes from needing a much fuller understanding of "reverse loops"; admitting this understanding sometimes only comes from experience.  There is a lot of information on understanding reverse loops available on the web; a search will bring perhaps too many results to wade through, so I'll do a very simplistic attempt at an explanation here, in case anyone reading this in the future is new to "reverse loops".

The basic issue causing any "reverse loop" situation is that the polarity of the track gets switched where one of the ends of the so-called loop connects back to a turnout.  In DC, the 2 rails of a track were marked as "+" and "-", and if one traced the path of whichever rail was their "+" rail through their layout and found where it came back to touch a rail marked as "-", one found the short-circuit that then occurs, resulting in what then was identified as a "reverse loop" condition.  In DCC, we often use the terms "A" and "B" for the 2 rails instead of "+" and "-" but they are the same thing; if the "A" rail comes back to connect to a "B" rail, you have a short circuit and, hence, a "reverse loop" condition.

Some basic considerations when dealing with "reverse loops" apply.

First, for a "reverse loop", the actual problematic track starts at a turnout and ends at another turnout - and the ending turnout may OR MAY NOT be the starting turnout.  Most diagrams used when discussing a "reverse loop" tend to show only one turnout and a 'true' loop of track (think of it as a single, long piece of flex track, if you will) attached to both legs of that turnout.  That's very easy to see.  What is not as easy is when the track in question attaches to 2 different turnouts.  (This is your case)

Whatever the situation, single or two turnouts, the basic issue that at some point, a short circuit would be created if the 2 track ends are not electrically isolated ("+" joined to "-" or "A" joined to "B"), and a means of some sort is needed so that track polarity is swapped to avoid the short circuit.

For DC, this 'swapping' of track polarity WITHIN the track segment that is isolated could have been something as simple as using a manual toggle switch to change the track polarity; for DCC, we generally use auto-reversers.  With an auto-reverser, in the simple case of a single turnout, you connect one side of it to the isolated track, and the other to the approach track (the leg of the turnout to which neither end of the isolated track is attached).  The reversing unit then sees the momentary short-circuit, which may be when entering or when leaving the isolated track section, and flips the polarity; pretty simple for the 'single turnout' situation.

Second, and the "why" of this sometimes is not fully understood until one gets a better understanding of "reverse loops", the isolated track where the polarity needs to be switched SHOULD NOT contain any turnouts.  Crossings are treated as turnouts for this purpose; they, too, should not be within the segment of track where the track polarity gets reversed (that center, isolated, part of them is a 'frog').  This has to do with how the power through the frogs is managed, contact between rails as the turnout is thrown, and other things, including the actual type of turnouts; if one is very advanced in wiring and using certain types of controls, one 'sometimes' can break this rule, but one shouldn't.  (Just like I know some guys who will work on rewiring an electrical socket without first turning off the power, just because it may be possible doesn't make it the right way to do it.)  So don't have your turnouts within the track where the polarity is reversed and you'll make your life much easier.  You won't fry too many brain cells and lose your hair as a result; I've managed to do both so I try to caution people from doing this.

Ok, now that we have a better understanding of what track needs to be the isolated segment, one additional thing about where I put those isolators. Because I power all my turnouts from each leg and don't rely on the frog or the points to carry the current through the turnout (saves dealing with wiring frogs, etc., and improves reliability).  I don't have the actual ends of the turnout legs 'isolated'; I have a track piece attached to each leg with isolators attached to the opposite end of that track piece.  That why I placed the isolators at the ends of those track pieces in my modified version of your layout.

Now, when you have the "reverse loop" track (the isolated segment) connected to 2 different turnouts this then becomes an interesting wiring exercise.  Think about how that has to work.  Depending on what reversing unit you choose, you'll need to follow the manufacturers advise on that wiring.  Hint: how many isolated track segments are there?

Oh, and a 'by the way' ... if a layout has a turntable, one gets to learn about "reverse loops" as well.
Tom Springer

(Unintentional Pyromaniac)


September 07, 2019, 08:35:53 am #21 Last Edit: September 07, 2019, 08:37:25 am by Keesoldscool
May I say that all above leads to the conclusion that the appearance of a red reverse loop in Anyrail is just a warning signal for the devellopers to pay attention to the builders that an isolation is needed and a auto-reverse module, just like this one?
Grtz.<br /><br />Kees

Tom Springer


The path marked by AnyRail just informs the user of the condition; the user then gets to handle it as they want... could be removing it or deciding where to make the isolation and where to install the reversing unit.

The concept of a "reversing loop' is discussed many places on the web (before the web, we said "in the literature" a lot...).

The "big" problem is one need not have a 'true' loop condition, where the track connects to the 2 legs of a turnout - the simple example used in the sited link, in the DigiTrax AR-1 description, and almost every other manufacturer's product support documents, is usually just this simple loop condition.  The condition in Bill's layout falls into the 'other' category, and unless one fully understands how to deal with reversing polarity conditions, wiring such an example like Bill's can be a "journey" to get correct.

I've always believed the model railroading hobby was about modelers helping other modelers, and I've always believed in "teaching", not "telling".  I ask questions to hopefully get others to 'solve' things without having been given the answer(s) ... maybe just a push in a direction.  That's why I answered Bill's original post.

There's a lot more to be 'learned' from understanding the complexity of how his "reverse loop" (polarity switching of that track segment) needs to be handled.  That first needed to identify the track segment (done, I think), then decide where to place the isolators to start with (also done... well, sort of). Then the next step is to check whether this works, by following all paths of a train through the reversing track segment and see, with a good knowledge of how polarity is changed, whether the isolators that were placed are the solution.

The easiest way to do this is to used the simple loop example where the track connects to both of the turnout legs, where the reversing unit is connected, and write one's explanation of "how things work", i.e., what the reversing unit actually does in operation and what triggers it to do that.

I was/am expecting the next post regarding Bill's layout to want to know where to connect the reversing unit.  This leads to the "ah ha" moment... because to know where to connect the unit means you know the purpose of those connections ... which means you 'know' how the unit works and why the connections have to be correct... and then you can decide how to deal with the additional complexity a layout like Bill's adds. And then you can teach the next generation.

I commend Bill for coming back and asking the "why" of what I showed because that's a desire to learn, and to expand an opportunity to leave something for future users to read, and hopefully, learn more about this part of our hobby.
Tom Springer

(Unintentional Pyromaniac)



You were obviously a teacher in an earlier life. I appreciate the time you are giving me. I know it is hard to write succinct and correct prose of any nature, all the harder for technical stuff.

I am going to study your last two missives a while and then get back to you.

I THINK I understand, but this is not my forte, so I am going to re-read it a few time.

AND, you are quite right, I will definitely ask where YOU would put the reversing units.

Anyone who has spent this much time and energy on helping me obviously has good reasons for where they would go.


"I find television very educating. Every time somebody turns on the set, I go into the other room and read a book." - Groucho Marx

Tom Springer


No, not a teacher, just a software designer, computer architecture developer, and an "anal engineer".  (Oh, and a father, the second hardest job in the world, after 'mother'.)  I'm not an expert, far from that, just an old guy who has learned a few things and, in keeping with the spirit of the hobby, trying to pass on the few things I've learned.

I think your post has been very useful in ways you might not imagine.  Here are a few:

  • Helping to potentially educate new AnyRail users on what "reverse loops" are and how to deal with them.
  • Helping to potentially educate new AnyRail users on how AR identifies "reverse loops".
  • A potential addition to AnyRail to help with the handling of "reverse loops".  (Potentially something 'simple')

I think that a discussion is in order about wiring a "reverse loop" because that also helps to understand a "reverse loop" and whether it will work.  Because ... once you deal with the (first) "reverse loop" that AnyRail identifies, there is a second one lurking that isn't so easy to deal with.  And wiring becomes the problem with that 'loop'.  Once the wiring aspects for "reverse loops" are understood, you may face a decision as to whether that second "reverse loop" can exist.

Regarding wiring and where the "connections" are made, it's more than where they go, it's really a matter of why they must go there, i.e., understanding what they do and how everything works.  Not just the "what" (the loop reverses trains), but "how" it makes that happen is critical (imho) to understanding "reverse loops", and whether any given one would work or just become a wiring/electrical nightmare.

So if you want to have this wiring discussion now, or want to wait until you get further, let me know.
Tom Springer

(Unintentional Pyromaniac)



Engineers ARE teachers. They just put their lessons into practice in a different way.

I am glad that you take this thread as an opportunity. I like that. I like learning, even when it makes my head hurt and I have to rework my plans.

I'm game, if you are. I promise to pay attention in class, and do my best to actually learn.

Again, I thank you for your time and effort.

"I find television very educating. Every time somebody turns on the set, I go into the other room and read a book." - Groucho Marx

Tom Springer

Preface: I'm writing this as if someone new to the "reverse loop" concept will read this some day, so I apologize up front if it seems too simple or at a very low level.

Reverse Loops

The most basic thing to know about a "reverse loop" is that it starts and ends at a single turnout; that is, the track path composing the "reverse loop" is attached to BOTH legs of that turnout.  This means that the electrical polarity of the track causes a 'short circuit' because it comes back onto itself 'reversed' (or flipped if you will).

The simplest diagram of a "reverse loop" trackage is what is found in most discussions about this, whether in forums or manufacturer's product descriptions.  It looks like this:

Reverse Loop example - 1.jpg

Most often you see a wye turnout used in these diagrams, but one could use any other type of turnout as they want, even a 3-way turnout.

Here's the same track diagram where I have colored various parts because I will refer to each of them by color in this discussion.

Reverse Loop example - 2.jpg

The wye turnout is in red, the track to which it's straight leg is attached - the track via which the train is entering the loop - is in light blue, the 2 curved track segments attached to each of the wye turnout's legs are in white, the 2 straight tracks attached to the other ends of the curved white tracks are in green, and the curved track segment that makes the loop back to the wye turnout is in yellow.

Operation of the loop

Using this diagram:

Reverse Loop example - 3.jpg

I've labeled the 2 paths outbound from the wye turnout, the left leg being the blue arrow path (marked "1") and the right leg being the orange arrow path (marked "2"); you can follow the colored arrows around the loop, noticing that, besides the presumed train flow, the flow of the electrical current is what the arrows also illustrate.  You can also think of this as water flowing down a pipe.  And realizing that the water can't flow because it meets "itself" coming back at it within the pipe.  This is the same thing as the electrical short circuit that is occurring within this loop.

The short circuit condition is "solved" by placing electrical isolators as track joiners where the yellow track joins the 2 green tracks.

One could place the isolators directly where the 2 white tracks attach to the 2 legs of the wye turnout, but I chose to do it at the yellow-green joiner area for multiple reasons.  I power turnouts from the legs, and don't rely on 'power-routing' through the frogs because I find the points making contact are not always reliable for current to flow properly; this is especially true as turnouts 'age' or if the track is dirty. It also saves me from having to alter the frogs of turnouts to maintain proper current flow and worrying about any short circuiting occurring as a metal wheel moves through the frog area.  (There is a lot of discussion on this matter on the web, if one is interested.)  So, for me, there are track feeders attached to the 2 white track segments (and the light blue track, as well).

I'll explain the 2 green straight tracks later.

What is the yellow track segment, and why is it important?

As the term "reverse loop" applies to all of the trackage attached to the starting turnout, there is another term, "reversing section", sometimes also called "reversing track" or a variation thereof, that is fundamental to the "reverse loop" concept; this is the yellow track segment.  It is this track segment where the electrical polarity of the track must be switched in order to allow a train to pass completely along the loop.  Why?  Each of those 2 green track has the same polarity - think of the left rail on each as being "+" and the right rail as being "-"; at the left end of the yellow track, the "+" from the left green track goes to the outside rail of the curved yellow track; but at the other end, this rail carrying "+" would connect to the right green track rail that is carrying '-".  Ouch, short circuit.  So, while the train is within the yellow track, the polarity of that track must be reversed in order to allow the train to exit that track.

There are two special considerations for this track segment.

First, you have to have a length that is long enough to hold your maximum train length.  That's the general recommendation and a good practice to follow.  Advanced modelers may know they can 'cheat' on this, but that takes a lot more understanding and experience and special considerations beyond what I want to put here.  I'll just keep it as (paraphrased) there are old modelers and there are bold modelers, but there aren't many old and bold modelers.

Second, because one is changing track polarity, one doesn't want anything like turnouts, or trackage from which power is taken for other purposes, to be within the reversed polarity track; these things can get really messed up if the electrical polarity coming into them gets flipped.

Ok, the yellow track in this example gets it's polarity flipped.  So how does that actually work?

Back in the DC days, the polarity change could be done using something as simple as a DPDT (double-pole, double-throw) toggle switch and the five-finger operation.  Wire the incoming current, the current coming from the green tracks (it's the same, regardless of which green track you would use) to the main part of the toggle switch and wire the outbound current to each of the other 2 'poles' of the toggle switch (one of these pole sets is wired opposite the other), and connect each outbound set to the yellow track (in 2 places, of course).  Only one of the outbound sets (paths) will be active at a time, so short circuits don't happen.  Flip the toggle switch one way and the current flows unchanged from the inbound direction; flip the toggle switch to the other side and the current comes out 'reversed' in polarity.  Pretty simple.  Except the train would then start running 'backwards' (in reverse), so one had to handle this through whatever throttle they were using - in effect, running the throttle 'in reverse' to make the train runs 'forward'.  Of course, one didn't do this without first stopping the train, then restarting it after the polarity was switched by changing the toggle switch.

DCC makes this a lot better/easier because we have special equipment, reversing units, that not only do all this but do it 'in an instant', and because the direction of travel is not determined by track polarity, but by the DCC information coming through the track power, no throttle changes are needed and the train appears to move smoothly, and continuously, in the same direction.

There are many 'reversing units' available from different manufacturers, but all work on the same principle - there are 2 connections for managing the track power, one for the 'source' (incoming) power wire set (set: "2-pair" wires) and one for the 'output' power wire set.  The reversing unit detects when the power polarity of the incoming wire set doesn't match the power polarity of the output wire set and changes the polarity of the output wire set to match that of the incoming wire set.  Understanding this is critical because these wire sets must be connected properly, each set connected to the appropriate track segment; they CANNOT be reversed.  And because these wires may be of some length, depending on where on the layout the connections to the tracks occur, and where the reversing unit is placed, it is extremely important that these wires be correctly labeled when first installed at the track connections; later on, if things are going to be moved/rearranged, you don't want to take the chance anything might get swapped, as you might end up shorting out things, or at least having "fun" doing troubleshooting.

DCC Reversing Unit connections

This is the diagram for connecting the reversing unit to our track.

Reverse Loop example - 4.jpg

The black wire is the incoming power wire set to the unit, and the red wire is the output power wire set that goes to the yellow track; even though each is a 2-wire set, I'll just use the terms "black wire" and "red wire".

The point where the red wire connects to the yellow track is labeled "R" (for reversing connection); in reality you can place it anywhere along the yellow track, but not at either end, of course, because you have isolated connectors there.  If the track is lengthy and you need multiple power feeders, you can run them from this wire.  You CANNOT attach any power feeders anywhere to the yellow track unless their other end(s) are attached only to (or through) the red wire.

[If you are also using block detection (a whole different discussion) or anything else such as other types of units that needs to get their power from the track power, then you have to worry about other considerations, so if you are into block detection and other similar concepts, try to keep those outside the yellow track and avoid additional headaches and hair-pulling that can otherwise occur.]

Ok, now the black wire ...

It MUST be connected to the track on the incoming side of the turnout; that's why it is attached to the light blue straight track segment connected to the turnout's straight leg (labelled "S" for source).  The reason is simple: that's where the power for all of this comes from, not via the turnout, but at the source of power INTO the turnout. 

You COULD try to connect it directly to the straight leg of the turnout, but as this is usually a very short track item, you'd probably have to use 'terminal joiners' to connect at the joint, unless you are really good at soldering on a short piece of track.  Personally, I'd worry about the heat from the soldering potentially melting/impacting the frog.  My preference is using terminal joiners between the turnout and the light blue straight track segment, with the power feeders from the booster attached at the other end of that straight track segment.

So how does this actually work?

As the train enters the wye turnout from the light blue straight track, let's presume that it will exit the wye turnout following path "1", the blue path going to the left.

As the engine (lead engine, if in a consist) crosses over from the green track to the yellow track (on the left side of the diagram) - as it crosses the isolated connection represented by the red "X" - one of two conditions will be present: the yellow track has the same polarity as the green track, or the polarity is reversed.  For example, it has the same polarity if the last train through the loop moved from that yellow track down through the green track on the left side, i.e., running the opposite way through the loop as the current train.  If the last train through this loop ran in the same direction as this train is going, the polarity would be reversed - the explanation for that comes next.

For now, we presume the yellow track's polarity matches the polarity of the green track.  So, as the leading wheels on the engine move across the green-yellow track boundary, the polarities match, no short circuit occurs, no switching needs to be done, and the train continues on as normal.  This occurs because the reversing unit doesn't detect any short circuit, because it "sees" that the polarity of the red wire matches the polarity of the black wire, and the unit does nothing.

As the train moves along the yellow track and reaches the yellow-green boundary on the right side (the red "X" at "2") - the green track there has a polarity that is the opposite of the yellow track, so as the yellow-green isolated connection is crossed, logically a short circuit occurs.  This is detected by the reversing unit because the red wire's polarity doesn't match the polarity of the black wire, and the unit then switches the polarity of the red wire, thereby switching the polarity of the yellow track.  All of this occurs "instantly"; the unit usually has an adjustment to set how fast this occurs, so that if there is a power booster for this track (or just the breaker in the command station) that would trip on a short circuit before the reversing unit made it's change, that reversing unit's timing can be adjusted so it acts before the booster/command station would.  Bottom line, the unit changes the polarity before the short circuit can be detected by the breaker in whatever booster/controller is supplying the power.

That's it.  The basic "reverse loop" concept in action.

Ok, what was the reason for those 2 green straight track segments?

Funny you should ask.

They 'could' have been turnouts.  Yes, it's possible to make this simple example more complex by adding turnouts in place of either/both of the green straight track segments - with appropriate tracks attached to the new turnout's outbound legs so as to allow for the isolators to be attached other than directly to the turnout's legs - it's really not a good idea to have the (logical) short circuit occur right at the turnout connection.  As long as the paths out of the other outbound legs of those turnouts don't come back to connect into the yellow trackage, things would be ok.  You could even make a second 'yellow track' loop back to these turnouts with it's own reversing unit, and it would work - a double "reverse loop" environment.  I've seen stranger track arrangements.

Here's that double reverse loop example:

Double Reverse Loop example.jpg

So now we know how a "reversing loop" works and where to place the reversing unit's connections.
Tom Springer

(Unintentional Pyromaniac)


Told you, you are a teacher.

Man, you must have spent a week tweaking the wording of this. It made sense the first time through (I think, leaving myself some wiggle room, here.).

I shall go color code a few things on my own tracks as soon as I can (not today, unfortunately). I REALLY like this. It is actually FAR simpler than I had expected, especially after several "Explanations" from other who were NOT teachers.


"I find television very educating. Every time somebody turns on the set, I go into the other room and read a book." - Groucho Marx

Tom Springer


Once you have dealt with the reversing loop that AnyRail identified, that second loop has to be considered.

Disconnecting the track within the reversing track section of the first loop will then lead to AnyRail identifying the second loop.  But that loop won't be easy to handle.  Hint: if you find yourself with a handful of hair, stop.
Tom Springer

(Unintentional Pyromaniac)


This is a very interesting thread. I am original a 3-rail guy, but I want to build a fiddleyard with has been removed since 1942. It is close to the village I'm born and it's an interesting one. I questioning myself using Tillig Elite 83 or PECO Streamline 75. But the trackplan also happens to haven a reversing loop, therefore I learn also, but it is not totally clear yet. So question will follow.
Grtz.<br /><br />Kees