refine code
deal with the authorization problem