added abstraction to layer implementation