Refactored Infobox manipulation code