Refactor gfycat functions