Making shallow and deep copies of objects