Wrote recursive filter (idk if it works)