Update for ARC and OS X 10.9

 - Cleans up the code a little
 - Added some memory leaks (which I don't think I am the cause of)