[OSX] [IM] More error resolving and refactoring.