Use rbegin() instead of --end()