Add defcomponent macro to reduce duplication