Refactoring to use type/module pattern.