More code added to check authorization