Clean code on layers.js