Organize page modification code into dedicated function