Added support for 'list -a' command
Minimal refactor