Refactor into a single module.
Move main module into top level.