refactors for readability

improved readability of code slightly by changing css order, providing
spaces around parentheses, and changing a keydown event to a keyup event