loaded a gif image and code refactoring
some minor changes