added configurable sorting