refactor logging; fix networking