refactored mutate