Improve the functionality of the layer palette in multi-layer mode.

This addresses some of the problems noted in #1828.