remove debug code
add debug logging