Short implementation for exercise 5