added ability to read from stdin