finsh problem 1 and part of problem 2 (typeinfer)