some refactoring and start auth support for bars