drawTree in separate function for better organization