cleanup, added save logic