change layer data processing to avoid extra lingering variable