Added arithmetic typechecking and codes 0,1,2