Almost a year when this PR was first propsed, now I am re-submitting it. Let me know if anything goes wrong.