Make register allocation more safe
Mild refactoring
Update Rust