minor comment changes, code rearrangement and field renaming