Added handling for orientation changes