Add methods to deal with rotation and layout changing