tidy up old function