Changed custom function op() to take references