modified gestion of layers to switch it on remove on in the stack