Entanglement: refactoring