Refactor to prevent argument reassignment