Implement flip and back button