Solved challenge 139
Optimized solution for challenge 139