Framework for PopupMVC - this is where the magic happens