clean up and refinements