Format code.
Calculate delta and limit frames.