fixing shallowCopy, cleanup