Updates from last night's hacking.  Fixed timing issues and cleaned up
some code