Change back to the previous version as it appears it's really faster to test and update rather than using max or min