Clean up cb script

Add xserver check and some other stuff.