This looks messy, this mix of if statement and if expression.  Clean it somehow?