Broke this out so I can link it to the sublime text plugin, just run
Split out main functions into a class to reuse it in a sublime text plugin