update lag calculation in main module