Added comments and cleaned upthe BasisFunctions code
Fixed conflicts between branches