new account unregister api and minor code cleanup