added save data functionality