added a new command to list sites, plus some refactoring