factor out a common Layer (again)