Added initial filtering code