Add periods and remove trailing whitespace.