Format this if/else chain a bit better.