A partial solution of the final task (no tests)