Misc external interface refactoring and fixes