This reverts commit 28f8dcda7e855dbfc570325c20cbe88ddcdf0b8c.

Preliminary attemp to separate some functionalities into 2 classes.