near final project1 version, may take a look at typecheck again