     
     // MARK: - Public API
     
+    /**
+     Searches for the passed in value, if present returns that node.
+     
+     - Parameter value: The value to be searched for.
+     - Returns: optional node with specified value.
+     */
     public func get(_ value: T) -> Node<T>?{
         return search(indexNode: root, value: value)
     }
     
+    /**
+     Places a new node with specified value into the current BinarySearchTree.
+     
+     - Parameter value: The value of the new node.
+     - Throws:
+         - RootNilException: if the root node's value is undefined.
+         - PreExistingValue: if there is already a node with the same value.
+     
+     */
     public func put(_ value: T) throws -> Void{
         if root == nil || root?.value == nil {throw NodeError.RootNilException}
         if table.contains(value) {throw NodeError.PreExistingValue}

        }
        if(indexNode?.value! == value){
            let parent: Node<T>? = indexNode?.parent!
            indexNode?.left?.parent = parent    //setting left & right children's parent to removal node's parent :(
            indexNode?.right?.parent = parent
            let ix: Int = table.index(where: {$0 as! T == value})!   //This means that duplicate values should not be allowed!!
            table.remove(at: ix)
            return indexNode
        }

open class BinarySearchTree<T: Comparable> {
    
    // MARK: - Properties
    private var table: [T] = [T]() {didSet {size = table.count}}
    var root: Node<T>? = Node<T>() {didSet {resetRoot((root?.value)!)}}
    var size: Int
    
