Implemented task for lab2.