Refactored appendPanel to use new private functions