added ability to read from stdin, meaning util can now be used for scripting.