fixed filter by role function
removed extraneous code