First attempt at challenge 42
Optimized solution for challenge 42