Added command factory, closes #38