Use lowercase l for layer variable.
Copy only used layers.
Do not create layers that are already present when paste is run.
Replace tabs by four spaces.