Linked the HTML and JavaScript and corrected bugs in the calculations.