problem 4 solved, and some stylistic optimizations made
Merge pull request #3 from holden-caulfield/problem4

problem 4 solved, and some stylistic optimizations made