finished the helper functions