Deleting 'copy-paste', fix some 'memory leaks'