split the addGuiItem function