Translated some comments and made some refactorings.