Edited Controller

Moved some variable declarations out of for loops.  Cleaned up some
comments.