Added data saving functionality