popup: functional popup's refactor