minor refinement and cleanup