improve reading commands from stdin