Mikes code for square