added fliptable function