setting and cleaning up