Maybe split this formula into multiple statements?
(should improve speed, might increase memory)

Or at least improve formatting to make it more readable?