Completed assignment by adding functions and comments.