Use a factory pattern for creating layers