Rewrote log engine and fixed compilation issues.