Change scales parameters to array type. Minor other fixes