End-to-end system running, along with some refactoring