Initial version of full pipeline, still need to debug and test