Refactored command factory to do deplayed creation of commands

Signed-off-by: Phan Le <ple@pivotallabs.com>