Re-arrange the code to use a module pattern.