Fixed input manager for keys > 323 and cleaned up code further