adds tree loading functionality