Updated with one line solution to problem 5