A lot of bug fixes which were encountered after changing the program to be faster.