improved gif functionality