implemented modify_copy, still fixing ref bugs