start of a large refactor