wrap logic to find maxTile in separate function