refactoring to make this a little easier to install on osx and linux