Changed the credentials to class

$credentials used to pollute global. Now it is a class that shares its
data as protected variables.