unify type and variable namespace, plus some other stuff