Clean up code by having all routines use the global variables for database and mcdir.