change printf to debug
add more logging