solution for final exercises 8