Added authorize function