Added check for reading empty input