Added min/max values swapping