strong refactoring of the original code

REfacored almost all the script in order to make it more modular and
flexible.