check
done
added back global register
added back test
code review changes
Merge pull request #8 from john-hill/optimize-register

Optimize register