added flip functionality