More improvements to help loops. See #1076