refactor variables to arguments for reusability