creating expandSquares method