Minors fixes and filter function