Complete refactor to module pattern.