Huge reorganisation of commands

I expect this commit to be buggy. I did a brief overview of all of the
command and they seem to work.