Implementation for a binary search tree and some basic functions