Final GIF containing algorithm