Refactoring ifs in the registerStyle method for a better legibility.