Added gif speed attribute. Some small fixes and cleaning up.