Added real time-based calculations to eliminate lags