Added error checking for new optimization
Fixed doc string
Removed any type assumptions

Also added error checking and diagnostic messages
Documentation fixes
Updated toolbox (and a little more documentation)