added new save logic