added a bit of max-min