Rework on handling, added input key functionality