Fix KVO deallocation errors in Mac project

+ General code cleanup