Zero-based rank, proper assignment

Rank is now zero-based, and gets assigned and saved properly when the
system checks if the rank exists yet.