Update listCommand.py: code refactor

Signed-off-by: Michael LeCompte <michaelslec98@gmail.com>