modified resizeByMaxSide method signature