General refactoring + Input/Event system