Some minor refactoring to support greater abstraction