My solutions for ex 1 and 2.