improved skipLayers with lambda functions