Added sorting to powers, and fixed several bugs in their display/editing.