more functionality for basis.jl, better type inferencing for statejoin