added some geometry funcs and tidied up
Added som failsafes to screen-registering and keyboard presses
added some consts
made sure textures are only rebound if necessary
Merge branch 'development'