improve computation of cap line position