Improve BasicAuth Code