Completed and simplified pb utils.