Added parameter to readInput() to make code more modular