refactored commands to use common code and interface