Moved leader check into its own loop.