Mac build prep

Adjust code so it compiles and works under mac.
Merge pull request #1 from haqman/osx

Mac build prep