PLD: refactor some modals functions in libs.modals