added comments for typecheck, typecheck is working properly