Fix typos. Get rid of iteration_counter in energy function.