Added comments on top of most functions.