added benchmark for the new scaling method
removed nested for loops