Adding constructor parameter to ensure the "type" is always set.