Versedi patch v0.3

Update the patch from @versedi with a few improvements after testing in different versions and browsers.