Changed to using a reverse iterator