making helper function