Another major refactoring to simplify