Remove commented code
Temporary save for find/replace layer->type to layer->type()
Encapsulate Layer::type
minor cleanup