Some optimizations regarding the work with layerz