Big refactoring (not yet complete) to merge code lines for topic and inline topics.