refactor type declaration codes