Added support for device rotation