Added declaration and documentation for sub-functions.