Refactored trait panel writing.