The origin of comets - Implications for planetary formation