add a logger and some improvements
fix conflict