add simplified maximize function