improving key support and adding test
refactoring application out
major refactoring - removed misc and put things into their correct place