Second attempt at adding OSX compatibility