Changed key names to key codes for browser compatibility