update: almost finish type checking