Write summary on a different file
A little more modular
Check for possible memory leak (not found)