Add comments and do some clean-up.