further tweeking to cut out unneeded work on each pass