Some refactoring, variable name, comments