Major refactoring; removed dependency on `keydown`, optimized and reduced code base a lot.

Fixes #2