refectored scaling