Used discardPreviousInputLine() everywhere necessary.