Am working through the commenting and factored out all the functions into a separate file.