refactoring variable names, slight polishing