move packagemaintenance to function