Deletes all unnecessary variables, added more comments, rephrased comments for clarity.