testing with no  barrier; pushed max_tiles into separate function while testing an optimization that didn't work out.