Added comments to both functions