Refactor for added OS X support
Clean ups
Bug description