Editing options and moving some max query logic around
Revert "Editing options and moving some max query logic around"

This reverts commit 99d39e8820f322215d1211171c3e7c2919dbd7f3.
Revert "Revert "Editing options and moving some max query logic around""

This reverts commit ddab74c9b9f4cab38bce0f4e1c15f9e839da6c61.