Refactoring variable name and functions