Some comments added, and slight code clean-ups.