add frame flipping code