added alternative solution to prob4