better version of solution for challenge 05