Refactoring: split purpleline.cpp up a bit