added lock-in calculation