Implementation of eval and step.