refactoring where larch arrays are calculated