updated to use credentials (should be backwards compatible)