added logging
fixed tests