Refactored code due to https://github.com/Gomasy/update_name/commit/aa3e80458ea5b4ed777d81841606c9eb6aaeab07