added esGui variable and cleaned up global scope