add before_filter and sorting