Initial codebase cleanup. Implement and test Key.js