Addition of discretization code.