Refactor to use $name instead of an argument