made some modifications and tested the code

Now the code has been tested on both 10.8.5+ and 10.9 GM