Re-rolled the patch against version 8.x-3.x-dev.
Please review.
Thanks!