add exception handling and credentials