Finished cleaning up and documenting code.