Fix OS X compile and restructure