Re-organise loops in paginating_form