Refactors variable name and removes unnecessary variable