adding filter and re-chaged BSD (you need to keep old BSD if you use that code)