only pan the map if we need to.
refactor codebase, ready for game loop
get rid of some compiler warnings