Setting up queries and gets for sort orders