Refactored code to use a class

Code cleanup

Updated README.md