Adding comments, small refactorings