Removed close() from StateManager; commented state.h
main's functions use ref parameters
Added debug printf to util