Fixed the rest of issute #7, moved parts of getInput to separate functions.