Simplify code and more complete inline docs...

... and more.