change upgrade to cleanup function