Improved perfomance when calculating contact chain