moved createPopupPie function to a more logical place