Added support for multiple devices.