Make ``main`` callable by external functions.
Move casa reduction routines into a module structure.