Log system added.
Lots of changes.