Implemented task 3.2 and part of 3.8.