final version. added log files.