can we break this bunch of boolean checks up a bit, I'm having a hard time figuring out exactly what it's doing