worked out logic for new layer scrolling feature