remove garbage code and add comments to the functions.
remove garbage