Many changes, some maybe usefull

I've set many comments so that my changes can be understand.