Added function to refresh and returns the client