Clean up formatting and improve function naming.

- also add typedef'ed enums for more clarity