This method has position-sensitive if blocks. Consider adding some test coverage to make refactoring safer.