worked on min/max problem (not done yet)