Some small changes to make it possible to change number of squares.
numberOfSquares has to be a factor of the width/height.