added clamping. Multilayer still not working