RK Added comments for some of the helper functions.