This should actually run fine on OS X 10.9. Probably.
Refactored stuff for easier management. Callbacks are fun \o/