Made popup API a lot nicer