Move data transformation function to site.js