Commit title: Refactor the code

Description:
    - refactor the code for the daemon analysis
    - Correction of some leaks memory, my bad