redesigned data interaction (not tested), added device state modification from gui