Rename helper functions and add comments