Improvements in device_query util and device module

In progress