Improve scaling function, various fixes