Added comments to the functions and variables used.