Added a factory class to use keypresses