layers now managed by shared_ptr