changed by Thomas (added seed params)
Changes from Fons but restoring the license text and formate.
fix coverity issue CID 10883
 fix few warnings
 remove unused variables