Added filter func
Added filter func
minor optimization