Refactoring peer code around.

Made a plan for how this whole thing is going to flow. Going to do a lot of refactoring to
modularize it now.