Tasks 5-8 solved