Added comments and fixed a few bugs for the extra credit of hw5