Completed writeSquares