Can this conditional stuff be wrapped into methods, or something, so that it's obvious what's going on? I get scared when I see big if/else blocks like this with heaps of comments.