Added support for night mode and rotation