merge unique_ptr fixes from master; purge unused files, etc