Lot of changes to support authorization