Implement lag computing, this will be rewritten.