exchanged the Offset helper class for an int[2]
BFS-backtracking queue-based group capturing implementation