Added a way to check the creds to see if its is an object or a location and handles it accordingly.

It would also be nice to separate the creds logic into its own function (i.e. put all the creds logic in one place).