Adding more docs and refining function prototypes.