modified device manager code from GaiaTestCase class