moved code, fixed division

Moved the keypress code from index.html and fixed division mode so it will now work