Refactor type extensions