Added implementation to basis_expansion