Fixed threshold bug. Had swapped height/width, doh!