Code cleaning
Merged duplicate async and normal functions.

Also started adding comments to functions.