Improve problem #50

I think this is a better solution now