changed the type of the scaling factors from int to double