improve circumference implementation