Major rewrite based on enum design and comments