read credentials from file; speed improvements