Refactor custom types API