Cleaned up code - fixed maj/min persistence

I think we're finally ready for the actual testing.