cleanup and command rebuild