moved device creation to click event