update documentation/comments, add newlineTrim helper function