Added pipes and bug fixes