cleanups and refinements