Initial implementation of tree constructor