Added comments to better explain defined functions.