Code to work on different size devices