introduced bug into ellipse calculation function