refactor codes, groups getItems, filter, sort for staff