added copy parameter to allow the option to modify in place