now only adding layers as they become visible.
fixed merge conflict