copy functionality, cleanup