Expose "layer" variable outside layer loop

We may want to use this after we're done!