This is an a first attempt at a rewrite of the smartsharp script.  There are lots of free parameters & it could probably work a lot better.