Improve type(): avoid the magic numbers