updated comments and boring refactorings.