series of empty commands error corrected; scanner.hasNextLine() added