changes getMax/MinMove to be monadic