documentation and some code beauty

Am creating a lib, so tidy up some comments and make const etc..

pete