Change root and sql log handling, rename functions