Minor cleanup
Preserve line breaks
Smarter trim (cut off last characters before final space or newline)
Dependency inject topic preview core, eliminates globals