Moved the input management to another class, using references where possible