Small change for speed and correctness.
Added enumeration type.