Major refactoring. No breaking changes.