Move some common tasks to a module