Change some enums to use flags. clean-up output a bit. Introduce user level log messages.