it looks wrong -- $type is used here both as human readable, and also as machine name