re-write main code to class
Merge pull request #2 from vigov5/develop

re-write main code to class