exp1 fix some logging bug + refactor code