Added resultToData function