started with a top dowm typechecker for reference