Additional comments added and a bug was fixed.