refactor regiter using register source