Implemnted saving function that works now