Create collapse button only when required, improving performance