This is probably pretty hard to read in the future. eg: "why are we doing `-1` here?" "Why +1 later"?

Recommend moving these bits of functionality to methods that have names that make sense to future-you