added sorting to pages