improving filter and cleaning up exceptions