RK added comments for a few helper functions