Imported remaining changes into deprecated branch for safe-keeping.