Replace BufferedReader with Scanner