Minor changes, code cleaned, some comments and docs added