Added support for hiding layers.
Added support for locked layers.
Implemented layer persistence.
Fixed some problems with layer persistence.