Cleaned, made log and made things more secure