Added ex3 solution