replaced analyzeTiles with onTileCallback in if statement.