Incomplete working function checkIfSubtree