made solution 5 a little faster