Refactor to module pattern.