improved ex3 and ex4, also changed order of task