Yosemite support added and some code simplifications
Cleaning up the code