Seperate post and popup logic