used guard to save the changes