code: private Optional<MutableQueryModifiers> extractTopQueryModifiers(IQ query) {
  		IQTree tree = query.getTree();
  		QueryNode rootNode = tree.getRootNode();
  		if (rootNode instanceof QueryModifierNode) {
  			Optional<SliceNode> sliceNode = Optional.of(rootNode)
  					.filter(n -> n instanceof SliceNode)
  					.map(n -> (SliceNode)n);
  
  			IQTree firstNonSliceTree = sliceNode
  					.map(n -> ((UnaryIQTree) tree).getChild())
  					.orElse(tree);
  
  			Optional<DistinctNode> distinctNode = Optional.of(firstNonSliceTree)
  					.map(IQTree::getRootNode)
  					.filter(n -> n instanceof DistinctNode)
  					.map(n -> (DistinctNode) n);
  
  			IQTree firstNonSliceDistinctTree = distinctNode
  					.map(n -> ((UnaryIQTree) firstNonSliceTree).getChild())
  					.orElse(firstNonSliceTree);
  
  			Optional<OrderByNode> orderByNode = Optional.of(firstNonSliceDistinctTree)
  					.map(IQTree::getRootNode)
  					.filter(n -> n instanceof OrderByNode)
  					.map(n -> (OrderByNode) n);
  
  			MutableQueryModifiers mutableQueryModifiers = new MutableQueryModifiersImpl();
  
  			sliceNode.ifPresent(n -> {
  							n.getLimit()
  									.ifPresent(mutableQueryModifiers::setLimit);
  							long offset = n.getOffset();
  							if (offset > 0)
  								mutableQueryModifiers.setOffset(offset);
  					});
  
  			if(distinctNode.isPresent())
  				mutableQueryModifiers.setDistinct();
  
  			orderByNode
  					.ifPresent(n -> n.getComparators()
  							.forEach(c -> convertOrderComparator(c, mutableQueryModifiers)));
  
  			return Optional.of(mutableQueryModifiers);
  		}
  		else
  			return Optional.empty();
  	}
docs: Assumes that ORDER BY is ABOVE the first construction node
  and the order between these operators is respected and they appear ONE time maximum