changed controlpanel to use global variables