Use named enums instead of ints for clearer documentation.
Group functions for documentation.