generalize all list command into simple functions.

Adding some structure to the list commands.