sidebar logic