Enhancements to some api/db functions