first commit, standardized update loop & key event handlers