Pattern matching instead of a function for each register!