the main var is double maxVal