Added Flexibility to code to cater for Portrait and Landscape Views