added additional comments and fixed all warnings except in BinTree2D