Working on mac

Merged your code and works on a mac, now we just need to make sure it does not break linux functionality =)

Let me know if you could verify