Converted the inlined if/else mess for tags into a registry based system.
Slight performance improvement (about 20%).