Make code work both with and without companion bar