v2

Adding HD mismatch and more optimized code