sort and page working