First working version of the whole pipeline