batch mode working now
max and min