Refactors TextPanel and braces with unit tests