Move Panels code, rearrange initialization orders