Nit: Mozilla convention is to cuddle elses, i.e. put them on the same line as the closing brace from the previous *if* block.