Separate KeyHandler

It wasn't totally necessary to have KeyHandler as a private class within MainThread. I moved it out to modularize things