Improved clipping problem

Changed calculateMax to findNewMax to let it run faster