added UTF-8 support for auth_file and simplified some of the code