Refactoring code, cleaning up cascade filter