Assignment 5.1 first solution

updated with more appropriate lodash methods, extracted functions, and doc blocks