moving system.register into the method.