Remove defmodel

Big internal cleanup to remove the var-resolution.