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