Clean Up
Code Clean Up, and minor bugs fixed.
Added new class to separate code.
Merge pull request #12 from chetankothari/m2cleanup

M2cleanup