Almost complete version. Need to uncomment functions to get a working pipeline but most of the functionalities should be in place