addes flip-based approach