updating and cleaning up