Solved ex4.2 and fixed 4.1.2 bugs.