Moved cocoa code into library
Moved code back into lib