Minor jshint fixes
Reduce duplication in render code
Test that layers without a title are ignored