time fix
HEAD fix
code cleanup
more cleanup