improved logging
refactoring
some changes and fixes to sdf