Added scale calculation into callback