use the new built-in getCmd function is available
removed hardcoded getCmd method
added test cases