add isAuthorized function with typos corrections