added save functions. made an alert for save function