refactored in preparation for adding new commands