added filtering with a bg model