added jsdoc comments; keydown.js: small refactoring