Added fn flip + tests.