Added logic to clear saved data before saving