refactoring api broker starting with logout