Fixed refreshImages and added screen size detection