Refactoring CommandInvoker