Move control menu UI code to new JS file