update and cleanup