pre-protocol code all typechecks