taking out the helper function