update game mechanics and clean up some code