Changed the code to ensure that the credentials file was used properly