added threshold and sort order