Please take a look at breaking this up somehow, it's basically unreadable.