Documentation and small refactorin(code cleaning)