moved things around, small changes in the code
added -s option, there's a bug in cases like '.X.O.' -> '.XXXX' in which an empty cell is ignored