Move control panel UI code to new JS file