Correctly sort existing stages.

Use a numeric sort instead of a lexicographical sort. The
lexicographical sort meant that we would create a new stage using a
stage name that already exist. The new stage is derived by sorting the
names, taking the numerical value of greatest value and adding one. The
values must be sorted numerically, not lexicographically for this to
work.

Closes #123.