Added code to accommodate different screen resolutions