added tests for command pattern 2 and 3, fixed code in build_command gsubs