improving the typechecking. still not there