added position function for popups