Phase 2 of reorganization

This is a follow on to #40 and will need to be rebased once #40 is merged