Made some useful functions for typechecking