Updated function to create seq and filter.