Completed working solution to problem

Overall the problem was not overly difficult