Refactor out type definition