Add error logging, use access group from environment.
Add debug logging.