changes to layer2.c