cleanups, comments, simplifications and temporary entity defs