refactor flush Queue command