Hmm, calculating squareroot twice. How to avoid?