Added better image handling