Cache jquery vars and tweak the keypress functionality

Cache the two commonly used variables so the script isn't constantly diving into the DOM to retrieve them and add some variables at the top of the keypress function just to make it more readable. Also, I've added in some comments about more caching.