Adding save logic