Trim for query and appearance.