made improvements to typechecking and promotion