Simplify with unifying createCommand and getFunction
Refactor