Rearranged to remove divide by zero