reg still not there
Merge terrence's register code