Fixed bugs with input and removed old code