move array filter with sort to a separate module