added function to scale data