I'm not super-excited about end-of-line conditionals. Is there a better way you can write this? Perhaps wrapping the whole thing in a helper?