Rewrite using STDIN and Readme.

Includes refactor of the code as well.