Modified read step to behave nicely with stdin.