Some cleanup and clearer comments, fix added tags

Added return at end of raw file line so that appended keys
in the dom will work.