Added functions to read to and write from the registers