simplified index.php
fixed the communication with the device