got rid of separate function to check degree of tree (unecessary)