wrote some stuff in discretization