More code cleanup and register access