further optimization

no if statements now... just maths