Extracts tree type into separate class