Refactor command framework for listeners