Pagos refactor