HW2 working v1.

Still needs to be cleaned up and documentation needs to be reviewed to
see if it still makes sense.
HW2 v2. Documentation has been cleaned up and changes were made to the
main function.