loaded a gif image and code refactoring