Add logging. Add better error handling.