Refactor defnstype