type refactor