Add some comments and refactor some variables names