added left and right flipping