Implemented parts of task 3.