trying global funcitons instead