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

Please always use braces on ifs (and loops, etc), even if only one line.