Modified population filtering script.