added saveData funcction