have clean solution for maxRect