clean up, and prepare for new command