Can we make lines 297 - 388 a new method? That will solve the problem with the method being too long. I'd consider changing the method length, but this method is actually hard to read.