changed algorythm to split tiles with largest perimeter