completed non-comiling version of sorting by popularity tests