Fixed keyListener. Refactoring parseInput method