More Debug output and snprintf instead of sprintf