Cleanup and refactor a bit o' stuff
Match osx changes