Sort management commands into appropriate areas.

Also remove upgrade_template - don't trust it.

Change-Id: Ifbae71cf52e457afd5a1014ecebce8614ef22fec