reorganize code, add log configuration.