Corrected the return of duplicate occurences of some entity flag types.

Contains following changes:
- Removed duplicate return of entity form types.
- Sorting entity form types alphabetically now.
- Cleaned up (only in the changed classes) and added some doc blocks.