solved problem 50, sloppily and slowly.