Updated logging to support multiple devices
Merged against master

Small code refactoring changes