Refactor protocol ryan

This adds fixes for compiling and running on Mac OSX