added some tests for sort_by
refactor questions sort by