Reworked the log engine