put dist and merge in dynamic vars
empty bulk
flush commands
use avl tree for fast nth