rearranged definitions for character and entity