ADD: device ID
MOD: refactoring and add test