Add method to write registers