Doing it all in one expression has gotten a bit out of hand here. Take the opportunity to introduce some intermediate variables for clarity if you can.