Clean up main module function a bit