move variable parameters to function to prevent persisting of values