Refactored main program.
Updated README.md.