Implemented more rigorous error checking for input reading.