enhancements to APIs and code cleanup