Refactor everything: command-line options, garbage collection with reference counting, distinction between external and managed paths, etc. etc.