Found a new way to implement the layer, without ifdefs.