Rearrange code to allow for fractions to be multiplied by constants