region code still buggy maybe because of the jagged arrays fix by using a struct or similar