Logic tweaks and tidy.