Refactorings to fix all kinds of timing/duplication bugs and simplify logic. Surface actual name from user API.