moved more behavior to Layer class