updated for minimize/maximize.