Massive refactor, reorganizing things to be more composable.