Deleting incomplete code; if I had more access, I could include all of it :-)
This functionality is native in 3.8.x