Cleaned up code to use the add_XXfile methods.