Formation of Planetary Systems