Some null checks and changed .txt logs to .log