Adding a read reg function.