Code cleanup and speed up problem 70