Stylistic point: Our js styleguide doesn't mention this specifically but lint would normally be angry at the lack of braces in this if/else statement.