layer resize code structure