Minors fixes and filter function
Merge pull request #197 from alex-seville/master

function as a filter, and minor fixes.