add logging
code quality improved