flush_all command and some internal design changes