extract command pattern