Alright, fixed everything so that it works on Mac.  That was fun.
Initial code added, working as it should