Added a comment on the tricky string manipulation.