Added tree traversing and validation in combinePath()