Initial refactor of authorization