added isPathContained implementation