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