Fixed bugs. Replaced diagonal flipping. Improved performance by at least 5%