added on path lenth calculation