Comb through older code and update to new style

Update and rewrite older code and comments to be consistent with newer
code.