mostly done. just need to improve matching algorithm and make BST