This is a pretty minor point but the `layer` pointer should be before the other attributes of the layer. 
This is a pretty minor point but the

layerpointer should be before the other attributes of the layer.