rewriting the mutate() function