Split filter and fold commands into two modules