Given all these conditions, might be good to put one condition per line to help make this clean. Just a nit.