Improved performance in layer generation