Removed unused variables, changed parseInput to a synchronized method