IDF tools: code cleanup and debugging