Third implementation:

added another line of code