added cleaning/filtering code