Moving common query methods to the top and removing duplicates.