template implementation for all commands